﻿using System;
using Autofac;
using Zinnia.Kernel.Inject.Core;
using Zinnia.Lite.Core;
using Zinnia.Lite.Core.Imp;

namespace Zinnia.Lite
{
    /// <summary>
    /// Lite依赖注入器
    /// </summary>
    public class LiteDependcyInjectRegister : IDependencyInjectRegister
    {
        public void Register(ContainerBuilder builder)
        {
            builder.Register<IZinniaLiteContext>(c => new ZinniaLiteContext()).InstancePerLifetimeScope();
            builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>)).InstancePerLifetimeScope();
        }
    }
}
